<?php
     header('content-type:text/html;charset=utf-8');

     $db_link=array(
        'host'=>'localhost:3306',
        'db_name'=>'root',
        'db_psw'=>'root',
        'db'=>'mi.com'
     );

     $mysql=new mysqli($db_link['host'],$db_link['db_name'],$db_link['db_psw']);

     if($mysql->connect_errno){
        die('连接失败'.$mysql->connect_errno);
    }
 
    $mysql->query('set name utf8');
 
    $selectdb = $mysql->select_db($db_link['db']);
 
    if(!$selectdb){
         die('数据库选择错误'.$mysql->error);
     }
?>